import { UserService } from './../../../../@core/services/user/user.service';
import { AfterViewInit, Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, Renderer2 } from '@angular/core';
import { NavigationEnd, Router, RouterEvent } from '@angular/router';
import { ConnectedPosition } from '@angular/cdk/overlay';
import { AppendToBodyDirection } from 'ng-devui/utils';
import { DialogService } from 'ng-devui';
import { EditPasswordComponent } from 'src/app/pages/basic-data/employs/employs/edit-password/edit-password.component';

@Component({
  selector: 'da-navbar',
  templateUrl: './navbar.component.html',
  styleUrls: ['./navbar.component.scss'],
})
export class NavbarComponent implements OnInit {
  @Input() data: any[];

  _mode: 'left' | 'top' = 'top';
  @Input() set mode(mode) {
    this._mode = mode;
  }
  get mode() {
    return this._mode;
  }
  constructor() {}
  ngOnInit(): void {

  }
  @Output() itemHovered = new EventEmitter<string>();
  @Output() topItemHovered = new EventEmitter<string>();
  activeItem: string;
  menuIcon: string;
  private timeoutId: any;
  setActive(item: any) {
    this.timeoutId = setTimeout(() => {
      this.activeItem = item.title;
      this.itemHovered.emit(item);
    }, 200);
  }
  onMouseLeave() {
    clearTimeout(this.timeoutId);
  }
  setTopActive(item: any) {
      this.activeItem = item.title;
      this.topItemHovered.emit(item);
  }
  scrollUp() {
    const element = document.querySelector('.da-nav-menu1');
      element.scrollLeft -= 100;

  }

  scrollDown() {
    const element = document.querySelector('.da-nav-menu1');
      element.scrollLeft += 100;
  }

}
